{% extends "bootstrap/base.html" %}

{% block title %}Flasky{% endblock %}

{% block head %}
{{ super() }}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="{{url_for('static', filename='styles/styles.css')}}">
<!-- <script src="//cdn.ckeditor.com/4.5.11/full/ckeditor.js"></script> -->

<!-- <script src="//cdn.tinymce.com/4/tinymce.min.js"></script> -->
<script src="{{ url_for('static',filename='tinymce/tinymce.min.js') }}"></script>
<!-- <script src="{{ url_for('static',filename='tinymce/jquery.tinymce.min.js') }}"></script> -->
<!-- <script src="{{ url_for('static',filename='tinymce/jquery.form.js') }}"></script> -->
<script src="{{ url_for('static',filename='tinymce/tinymce_setup.js') }}"></script>
<!-- <script>tinymce.init({ selector:'textarea' });</script> -->
{% endblock %}

{% block navbar %}
<div class="navbar navbar-inverse" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{{ url_for('main.index') }}">Flasky</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li><a href="{{ url_for('main.index') }}">Home</a></li>
                <li><a href="{{ url_for('main.upload_file') }}">Upload</a></li>
                <li><a href="{{ url_for('main.ckeditor_test') }}">Ckeditor Test</a>
                <li><a href="{{ url_for('main.article_list') }}">Article list</a>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                {% if current_user.is_authenticated %}
                <!-- 下拉菜单dropdown -->
                <li>
                    <a href="{{ url_for('main.user',username=current_user.username) }}">
                    <img class="img-circle" src="{{current_user.gravatar(size=20)}}">
                    </a>
                </li>
                <li class=dropdown>
                    <a href="#" class="dropdown-toggle" data-toggle='dropdown'>{{current_user.username}}
                    <!-- caret向下小三角 -->
                    <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" >
                        <li ><a href="{{ url_for('main.user',username=current_user.username) }}">Profile</a></li>
                        {% if current_user.is_administrator() %}
                            <li><a href="{{url_for('main.userlist')}}">Userlist</a></li>
                        {% endif %}
                        <li ><a href="{{ url_for('auth.change_password') }}">Change Password</a></li>
                        <li ><a href="{{ url_for('auth.change_email_request') }}">Change Email</a></li>
                        <!-- divider 分割线 -->
                        <li class="divider" ></li>
                        <li ><a href="{{ url_for('auth.logout') }}">Log Out</a></li>
                    </ul>
                </li>
                {% else %}
                <li><a href="{{ url_for('auth.register') }}">Register</a></li>
                <li><a href="{{ url_for('auth.login') }}">Log In</a></li>
                {% endif %}
            </ul>
        </div>
    </div>
</div>
{% endblock %}

{% block content %}
<div class="container">
    {% for message in get_flashed_messages() %}
    <div class="alert alert-warning">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        {{ message }}
    </div>
    {% endfor %}

    {% block page_content %}{% endblock %}
</div>
{% endblock %}

{% block scripts %}
{{ super() }}
{{ moment.include_moment() }}
{% endblock %}
